<template>
	<view>
		<p-navbar title="新手指南"></p-navbar>
		<hide v-if="news.length=='0'" />
		<view class="news" v-for="(item,index) in news" :key="index" @tap="router(item)">
			<view class="">
				<view class="newes" :style="{'margin':item.add_time?'0rpx':'25rpx 0rpx 25rpx'}">
					<!-- 图片 -->
					<view class="left">
						<image :src="item.image || defaul" mode="aspectFill"></image>
					</view>
					<view class="right">
						<!-- 标题 -->
						<view class="news-item-title">{{item.headLine}}</view>
						<!-- 内容 -->
						<view class="bottom flex justify-between align-items footer" style="color: #fff;">
							<!-- 创建时间 -->
							<view class="news-item1">{{util.sub(item.createDt,10)}}</view>
							<!-- 观看人数 -->
							<view class="">
								<image src="../../static/college/yanjin.png" style="width: 32rpx;height: 20rpx;margin-right: 10rpx;"></image>
								<text style="color: #000000;">{{item.browse || 0}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				defaul: '/static/logo.png', //默认图片
				news: [],
				pages: 1
			};
		},
		computed: {
			num() {
				return t => {
					if (!t) return '0.0000';
					return Number(t).toFixed(4)
				}
			},
			cases() {
				return t => {
					if (!t) return t;
					return t.toUpperCase();
				}
			},
			html2text() {
				return t => {
					let data = t.replace(/&nbsp;/g, '')
					return data.replace(/\s*/g, '').replace(/<[^>]*>/g, '');
				}
			},
			rep() {
				return t => t.replace(/&nbsp;/g, '')
			},
			option() {
				return this.$state.user
			},
		},
		onShow() {

			this.notive()
		},
		methods: {
			notive() { //公告
				this.request.post('guideMessage/list')
					.then(res => {
						if (res.data.code === 1) {
							this.news = res.data.data
						}
					})
			},
			router1() {
				uni.navigateTo({
					url: './home'
				})
			},

			router(item) {
				this.$Router.push({
					path: '/pages/college/notice',
					query: {
						type: JSON.stringify(item)
					}
				})
				// uni.navigateTo({
				// 	url: './notice?type=' + JSON.stringify(item)
				// })
			},
		}
	};
</script>

<!-- <style>

page {
	height: 100%;
	/* background-color: #f2f2f2; */
	background-color: #FFFFFF;
}

</style> -->

<style lang="scss">
	page {
		// background: rgba($border-color-base, 0.2);
		// background: $back;
	}

	.hq {
		display: flex;
		justify-content: space-between;
		padding-left: 30rpx;
		// background:#fff;
		// height: 110rpx;
		font-size: 38rpx;
		font-family: PingFang;
		font-weight: bold;
		line-height: 52px;
		color: #FFFFFF;
	}

	.fooler {

		// padding: 0rpx 20rpx 20rpx;
		// margin-top: 20rpx;
		border-bottom: 1px solid #2E3252;

		.fooler-title2 {
			background: #fff;
			display: flex;
			justify-content: space-around;
			padding: 0rpx 20rpx;

			// border: 1px solid #fff;
			// margin: 0rpx 0rpx 20rpx;
			.title2 {
				// border: 1px solid #fff;
				// width: 12%;
				// border: 1px solid #fff;
				margin: 0rpx 10rpx 0rpx 30rpx;
				// transition: 0.5s;
				// padding-left: 15rpx;
				text-align: center;
				font-size: 30rpx;
				font-family: PingFang;
				font-weight: bold;
				line-height: 55rpx;
				color: blue;

			}
		}


	}

	.news {
		width: 90%;
		margin: 40rpx 40rpx;

		.news-item1 {
			text-align: center;
			font-size: 28rpx;
			font-family: PingFang;
			font-weight: 500;
			// line-height: 80rpx;
			color: #000000;
		}

		.newes {
			padding: 30rpx 10rpx;
			box-sizing: border-box;
			width: 100%;
			background: $color-bgs;
			// box-shadow: 0px 10px 12px rgba(204, 211, 255, 0.05);
			opacity: 1;
			border-radius: 10px;
			display: flex;
			justify-content: space-between;

			.left {
				width: 150rpx;
				height: 150rpx;
				margin: 0rpx 10rpx 0rpx 30rpx;
				overflow: hidden;

				image {

					border-radius: 16rpx;
					width: 100%;
					height: 100%;
				}
			}

			.right {
				width: 63%;
				position: relative;

				.news-item-title {
					word-break: break-word;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 2;
					-webkit-box-orient: vertical;
					font-size: 28rpx;
					line-height: 45rpx;
					font-family: PingFang;
					font-weight: bold;
					// color: #FFFFFF;
				}

				.news-item2 {
					word-break: break-word;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 2;
					-webkit-box-orient: vertical;
					font-size: 28rpx;
					font-family: PingFang;
					font-weight: bold;
					// color: rgba(255, 255, 255, 0.65);
					margin-top: 15rpx;
				}

				.news-item3 {
					margin: 10rpx 20rpx 0rpx;
					// padding: 20rpx 20rpx;
					padding-bottom: 5rpx;
					line-height: 40rpx;
					font-size: 24rpx;
					font-family: PingFang;
					font-weight: 500;
					// line-height: 34rpx;
					color: #999999;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 3;
					-webkit-box-orient: vertical;
				}

				.footer {
					width: 100%;
					position: absolute;
					left: 0;
					bottom: 0;
				}
			}
		}
	}

	.position {
		position: absolute;
		left: 160rpx;
		font-size: 15rpx;
		font-family: PingFang;
		font-weight: 500;
		padding: 0rpx 10rpx;
		color: #FFFFFF;
		background-color: #E31345;
		border-radius: 24rpx;
	}

	.swiper-text {
		background: transparent;
		margin-top: 50rpx;
		// width: 100%;
		text-align: center;
		font-size: 26rpx;
		font-family: PingFang;
		font-weight: 400;
		line-height: 36rpx;
		color: #999999;

		image {
			width: 186rpx;
			height: 201rpx;
			margin-bottom: 20rpx
		}
	}
</style>
